package Day04;

import java.util.Scanner;

public class Calculator {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		System.out.println("将开始10次加法测试,每题10分...");
		int score = 0;
		for (int i = 1; i <= 10; i++) {
			int num1 = (int) (Math.random() * 100);
			int num2 = (int) (Math.random() * 100);
			System.out.println("(" + i + ")."+num1+"+"+num2+"=？");
			System.out.print("请输入答案(输入-1退出):");
			int num = scan.nextInt();
			if(num == -1) {
				System.out.print("此次检测结束,你的分数是:"+score);
				return;
			}else if(num == num1 + num2) {
				score += 10;
				System.out.println("Correct");
			}else {
				System.out.println("Error");
			}
		}
		System.out.print("此次检测结束,你的分数是:"+score);
		scan.close();
	}

}
